package java51.demo18;

import java.util.*;

public class MapTest {

	public static void main(String[] args) {
		Map map = new HashMap();
		map.put("tallest", "李双");
		map.put("shuai", "李鹏涛");
		map.put("fat", "胡仁超");
		map.put("thin", "吴宇博");
		map.put("ugly", "李鹏涛");
		map.put("shuai", "李坤");

		System.out.println(map.size());
		System.out.println(map);
		String thin = (String) map.get("thin");
		System.out.println("最瘦的是" + thin);
		// Object r = map.remove("fat");
		// System.out.println(r + "被删除了");
		// System.out.println(map.size());
		// System.out.println(map);
		System.out.println(">>>>>>>>>>>>>>>>>>>>>");

		boolean fatIn = map.containsKey("fat");
		System.out.println("fat 在不在？" + fatIn);
		System.out.println("????????????????????????????/");
		map.put(new Dog("哮天犬", "黑", 10000), "最厉害的狗");
		map.put(new Dog("哮天犬", "白", 20000), "最长寿的狗");
		System.out.println(map.size());
		System.out.println(map);
		System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>");
		// map.keySet():获得所有的key
		// map.values():所有的value的集合
		// 循环Map
		System.out.println("循环处理Map");
		Set keys = map.keySet();
		for (Object obj : keys) {
			System.out.println(obj + "=" + map.get(obj));
		}
	}

}
